﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UboxUI
{
    public partial class FrmUser_Father : Form
    {
        public FrmUser_Father()
        {
            InitializeComponent();
            this.ban01.BringToFront();
            this.BtnClose.Left = this.Width - this.BtnClose.Width - 10;
            this.BtnNarrow.Left = this.BtnClose.Left - this.BtnNarrow.Width - 10;
            this.ban01.Top = 0;
        }
        bool check = true;
        private void BtnClose_MouseLeave(object sender, EventArgs e)
        {
            if (check)
            {
                this.BtnClose.BackgroundImage = imageList1.Images[0];
            }
        }

        private void BtnClose_MouseEnter(object sender, EventArgs e)
        {
            this.BtnClose.BackgroundImage = imageList1.Images[1];
        }

        private void BtnNarrow_MouseLeave(object sender, EventArgs e)
        {
            this.BtnNarrow.BackgroundImage = imageList1.Images[2];
        }

        private void BtnNarrow_MouseEnter(object sender, EventArgs e)
        {
            this.BtnNarrow.BackgroundImage = imageList1.Images[3];
        }

        private void BtnClose_Click(object sender, EventArgs e)
        {
            check = false;
            this.Close();
        }

        private void BtnNarrow_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        int currX, currY;
        bool isFrmMove = false;

        private void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                this.currX = e.X;
                this.currY = e.Y;
                this.isFrmMove = true;
            }
        }

        private void panel1_MouseMove(object sender, MouseEventArgs e)
        {
            if (this.isFrmMove)
            {
                this.Location = new Point
                    (this.Left + e.X - this.currX, this.Top + e.Y - this.currY);
            }
        }

        private void panel1_MouseUp(object sender, MouseEventArgs e)
        {
            this.isFrmMove = false;
        }


    }
}
